<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition template="/HomeTemplate.xhtml"
                xmlns="http://www.w3.org/1999/xhtml"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:p="http://primefaces.org/ui"
                >
    <ui:define name="body">
        <div class="main-container" >
            <p:tabMenu id="tab1" model="#{dynamicMenu.getSimpleMenuModel(3)}" style="width: 90%"  />
            <h:form id="form" style="width: 90%" > 
                <p:panel style="border-bottom: none; width: 90%" >
                    <h:panelGrid columns="4"  style="border-bottom-width: 0px; border-spacing: 0px; ">
                        <h:outputText value="Start Date"/>  
                        <p:calendar value="#{claimBean.start}" id="start" showOn="button" pattern="dd/MM/yyyy" /> 
                        <h:outputText value="End Date"/>  
                        <p:calendar value="#{claimBean.finish}" id="end" showOn="button" pattern="dd/MM/yyyy" /> 
                    </h:panelGrid>
                    <h:panelGrid columns="6"  style="border-bottom-width: 0px; border-spacing: 0px; ">

                        <h:outputText value="Claim No :" />  
                        <p:inputText id="claimNo" value="#{claimBean.claimNo}" style="width:150px; height: 25px" >

                        </p:inputText>
                        <h:outputText value="Frame Series No :" />                
                        <p:inputText id="frameNo" value="#{claimBean.frameNo}" style="width:150px; height: 25px" >

                        </p:inputText>


                    </h:panelGrid>
                    <h:panelGrid columns="4" cellpadding="5" style="border-bottom-width: 30px">  
                        <p:commandButton  value="Filter" icon="filter"  action="#{claimBean.filterCriteria()}" update="dataTable"></p:commandButton> 
                        <p:commandButton  value="PDF" icon="pdf"> </p:commandButton> 
                        <p:commandButton  value="Excel" icon="excel" action="#{authentication.logout()}"> </p:commandButton>
                        <p:commandButton value=" Detalles "   style="color: #0072C6;" action="#{replicateOrderBean.orderById()}" > </p:commandButton>
                    </h:panelGrid>
                </p:panel>

                <p:dataTable id="dataTable" var="claim" value="#{claimBean.claims}" widgetVar="claimTable"  style="width: 90%">

                    <p:ajax event="rowToggle"  />

                    <p:column style="width:2%">  
                        <p:rowToggler />  
                    </p:column>
                    <p:column headerText="Claim Id">  

                        <h:outputText value="#{claim.idClaim}"  >

                        </h:outputText>
                    </p:column>
                    <p:column headerText="Model Name">  

                        <h:outputText value="#{claim.idCatalog.modelName}"  >

                        </h:outputText>
                    </p:column>

                    <p:column headerText="Model Year">  
                        <h:outputText value="#{claim.idCatalog.modelYear}" />  
                    </p:column> 
                    <p:column headerText="Frame No">  
                        <h:outputText value="#{claim.frameNo}" />  
                    </p:column> 

                    <p:column headerText="Size">  
                        <h:outputText value="#{claim.frameSize}" />  
                    </p:column>  

                    <p:column headerText="Claim Item" >  
                        <h:outputText value="#{claim.idClaimItem.description}" />
                    </p:column>  

                    <p:column headerText="Status">  
                        <h:outputText value="#{claim.idClaimStatus.description}" />  
                    </p:column> 

                    <p:column headerText="Claim Order">  
                        <h:outputText value="#{claim.warrantyOrder}" />  
                    </p:column> 

                    <p:column headerText="Claim Date">  
                        <h:outputText value="#{claim.dateClaim}">
                            <f:convertDateTime pattern="dd/MM/yyyy"></f:convertDateTime>
                        </h:outputText>

                    </p:column> 

                    <p:column headerText="Closed Date">  
                        <h:outputText value="#{claim.dateClosed}">
                            <f:convertDateTime pattern="dd/MM/yyyy"></f:convertDateTime>
                        </h:outputText>   
                    </p:column> 

                    <p:rowExpansion>  
                        <h:panelGrid id="display" columns="2" cellpadding="4" style="width:100%;"  
                                     styleClass=" ui-widget-content grid" columnClasses="colp1,colp2" >  

                            <f:facet name="header">  
                                Claim Details
                            </f:facet>  

                            <h:outputText value="Claim Description" />  
                            <h:outputText value="#{claim.claimDescription}" />  
                            <h:outputText value="Height" />  
                            <h:outputText value="#{claim.height}" />  
                            <h:outputText value="Weight" />  
                            <h:outputText value="#{claim.weight}" />  
                            <h:outputText value="Confirm Date" />  
                            <h:outputText value="#{claim.dateConfirm}">
                                <f:convertDateTime pattern="dd/MM/yyyy"></f:convertDateTime>
                            </h:outputText>  
                            <h:outputText value="Situation description" />  
                            <h:outputText value="#{claim.situationDesc}" /> 
                            <h:outputText value="Notes" />  
                            <h:outputText value="#{claim.notes}" /> 
                            
                        </h:panelGrid>  

                    </p:rowExpansion>  

                    <f:facet name="footer">  
                        In total there are #{claimBean.claims.size()} Claims.  
                    </f:facet>  

                </p:dataTable> 


            </h:form>
        </div>
    </ui:define>
</ui:composition>




